﻿using System;
using System.Xml.Linq;

namespace vm.Aspects.ExpressionSerialization
{
    /// <summary>
    /// Represents the serialization behavior for various types of objects.
    /// </summary>
    public interface IConstantXmlSerializer
    {
        /// <summary>
        /// Serializes the specified constant.
        /// </summary>
        /// <param name="constant">The constant to be serialized.</param>
        /// <param name="type">The type of the constant (if needed).</param>
        /// <returns>The XElement generated by the serializer representing the type and the value of the <paramref name="constant"/>.</returns>
        XElement Serialize(object constant, Type type);

        /// <summary>
        /// Deserializes an object from the specified XML element.
        /// </summary>
        /// <param name="element">The XML element to deserialize from.</param>
        /// <param name="type">The type of the constant (if needed).</param>
        /// <returns>The deserialized object.</returns>
        object Deserialize(XElement element, Type type);
    }
}
